import tkinter as tk
from PIL import Image, ImageTk
import cv2


class VideoDisplay:
    def __init__(self, root):
        self.root = root
        self.label = tk.Label(self.root)
        self.label.pack()

    def update_frame(self, frame):
        frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
        img = Image.fromarray(frame)
        imgtk = ImageTk.PhotoImage(image=img)
        self.label.imgtk = imgtk
        self.label.config(image=imgtk)
